import request from './Interceptor'



// 仓库----------------------------------------------------------------------------------------------------------------
export const searchWareHouse =(WareHouse)=>{    
    return  request.post('/store/store-list',WareHouse);
}
export const addWareHouse =(WareHouse)=>{
    return request.post('/store/addStore',WareHouse);
}   
export const changeWareHouse =(WareHouse)=>{
    return request.post('/store/updateStore',WareHouse);
}   
export const deleteWareHouse =(storeId)=>{
    return request.post(`/store/deleteStore/${storeId}`,storeId);
}   

export const searchWareHouseName =()=>{
    return request.post('/store/storeName');
}   


//员工----------------------------------------------------------------------------------------------------------------
export const searchEmployee =(Employee)=>{    
    return  request.post('/employee/search',Employee);
}

export const addEmployee =(Employee)=>{
    return request.post('/employee/add',Employee);
}
export const changeEmployee =(Employee)=>{
    return request.post('/employee/update',Employee);
}

export const deleteEmployee =(employeeCode)=>{
    return request.post(`/employee/delete/${employeeCode}`,employeeCode);
}
export const searchEmployeeName =()=>{
    return request.post('/employee/searchName');
}

//库区----------------------------------------------------------------------------------------------------------------


export const addArea =(area)=>{
    return request.post(`/area/add`,area);
}
export const searchArea =(area)=>{
    return request.post(`/area/search`,area);
}
export const deletehArea =(id)=>{
    return request.post(`/area/delete/${id}`,id);
}
export const updateArea =(area)=>{
    return request.post(`/area/update`,area);
}
export const searchAreaName =()=>{
    return request.post('/area/searchName');
}


//装卸点----------------------------------------------------------------------------------------------------------------

export const addPosition =(position)=>{
    return request.post(`/LoadingPosition/add`,position);
}
export const deletePosition =(id)=>{
    return request.post(`/LoadingPosition/delete/${id}`,id);
}
export const searchPosition =(position)=>{
    return request.post(`/LoadingPosition/search`,position);
}
export const updatePosition =(position)=>{
    return request.post(`/LoadingPosition/update`,position);
}
export const searchPositioName =()=>{
    return request.post('/LoadingPosition/searchName');
}


//货架----------------------------------------------------------------------------------------------------------------
export const addShelf =(Shelf)=>{
    return request.post(`/shelf/add`,Shelf);
}
export const searchShelf =(Shelf)=>{
    return request.post(`/shelf/search`,Shelf);
}
export const deleteShelf =(shelfId)=>{
    return request.post(`/shelf/delete/${shelfId}`,shelfId);
}
export const updateShelf =(Shelf)=>{
    return request.post(`/shelf/update`,Shelf);
}
export const searchShelfName =()=>{
    return request.post('/shelf/searchName');
}

//入库单----------------------------------------------------------------------------------------------------------------
export const searchInStore =(inStore)=>{
    return request.post(`/instore/search`,inStore);
}
export const searchInStoreGoods =(id)=>{
    return request.post(`/instore/searchGoods/${id}`,id);
}
export const addInStore =(inStore)=>{
    return request.post(`/instore/add`,inStore);
}
export const deletehInStore =(id)=>{
    return request.post(`/instore/delete/${id}`,id);
}
export const updateInStore =(inStore)=>{
    return request.post(`/instore/update`,inStore);
}
export const updateStatus =(inStore)=>{
    console.log(inStore);
    return request.post(`/instore/updateStatus`,inStore);
}


//入库作业单----------------------------------------------------------------------------------------------------------------
export const searchInOperation =(InOperation)=>{
    return request.post(`/inOperation/search`,InOperation);
}
export const searchInOperationGoods =(id)=>{
    return request.post(`/inOperation/searchGoods/${id}`,id);
}
export const updateInOperation =(InOperation)=>{
    return request.post(`/inOperation/update`,InOperation);
}
export const updateInOperationStatus =(InOperation)=>{
    return request.post(`/inOperation/updateStatus`,InOperation);
}

//出库单----------------------------------------------------------------------------------------------------------------
export const searchOutStore =(inStore)=>{
    return request.post(`/outStore/search`,inStore);
}
export const searchOutStoreGoods =(id)=>{
    return request.post(`/outStore/goods/${id}`,id);
}
export const addOutStore =(inStore)=>{
    return request.post(`/outStore/add`,inStore);
}
export const updateOutStore =(inStore)=>{
    return request.post(`/outStore/update`,inStore);
}
export const updateOutStatus =(inStore)=>{
    console.log(inStore);
    return request.post(`/outStore/updateStatus`,inStore);
}

//出库作业单----------------------------------------------------------------------------------------------------------------
export const searchOutOperation =(InOperation)=>{
    return request.post(`/outOperation/search`,InOperation);
}
export const searchOutOperationGoods =(id)=>{
    return request.post(`/outOperation/searchGoods/${id}`,id);
}
export const updateOutOperation =(InOperation)=>{
    return request.post(`/outOperation/update`,InOperation);
}
export const updateOutOperationStatus =(InOperation)=>{
    return request.post(`/outOperation/updateStatus`,InOperation);
}


//库存----------------------------------------------------------------------------------------------------------------
export const searchStock =(stock)=>{
    return request.post(`/stock/stock-list`,stock);
}


//登录----------------------------------------------------------------------------------------------------------------
export const verification =()=>{
    return request.get(`/login/verificationCode`);
}
export const loginning =(user)=>{
    return request.post(`/login/login`,user);
}

//注册----------------------------------------------------------------------------------------------------------------
export const registering =(user)=>{
    return request.post (`/login/register`,user);
}

//权限----------------------------------------------------------------------------------------------------------------
// export const getRole = (userName) => {
//     return request.post('/permission/get',userName);
// }

export const getRole = (userName) => {
    const formData = new FormData();
    formData.append('userName', userName);
    
    return request({
        url: '/permission/get',
        method: 'post',
        data: formData,
        headers: {
            'Content-Type': 'multipart/form-data'
        }
    });
}


//用户----------------------------------------------------------------------------------------------------------------
export const searchUser =(user)=>{
    return request.post(`/user/search`,user);
}

